package com.andnnl.redis;

/**
 * Created by chenss on 2021/5/7.
 */
public class UtilsitiesTest {
    public static void main(String[] args) {
        byte[] bs=new byte[]{-29,-42};
        int a=Utilities.bytes2Int2bytes(bs);
        System.out.println(a);

        int rs=0;
        for (int i = 0; i < bs.length; i++) {
            rs<<=8;//左移8位
            System.out.println(Integer.toBinaryString(bs[i]));
            rs|=bs[i] & 0xff;//只保留最右边8位
//            rs|=bs[i] & 255;
            System.out.println(Integer.toBinaryString(rs));
            System.out.println(rs);
        }
        System.out.println(Integer.toBinaryString(0xff));
    }
}
